<extend name="Public/base"/>

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>业务统计</h2>

	</div>
    <div class="tools">
            <form action="{:U()}" method="post">
                选择时间：
                <input type="text" value="{$begin}" name="time_start" class="date" style="width:80px;" onclick="laydate()"> - <input type="text" value="{$end}" name="time_end" class="date" style="width:80px;" onclick="laydate()">
				业务类型：
				<select name="leibie">
						<option value="" <eq name="lb" value="NULL"> selected </eq>  >所有</option>
                        <volist name="liebei" id="vo">
                        <option value="{$vo.uid}" <eq name="vo.uid" value="$lb"> selected </eq>  >{$vo.name}</option>
                        </volist>
                </select>
                <span class="buttons">
                    <input type="submit"  id="submit" class="btn" value="开始查询">
                </span>
            </form>
    </div>

    <div id="shuju" style="width: 100%;height:400px;margin-top: 20px;"></div>
<script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('shuju'));

        // 指定图表的配置项和数据
        

        option = {
            tooltip: {
                trigger: 'axis'
            },
            toolbox: {
                feature: {
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            legend: {
                data:['线上成交','线下成交','套系均价']
            },
            xAxis: [
                {
                    type: 'category',
                    data: [<foreach  name="_list" item="vo">
                               '{$vo.time|substr=###,8}日',
                           </foreach>]
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    name: '成交单量',
                    min: 0,
                    max: 50,
                    interval: 10,
                    axisLabel: {
                        formatter: '{value} 单'
                    }
                },
                {
                    type: 'value',
                    name: '套系均价',
                    min: 0,
                    max: 20000,
                    interval: 2000,
                    axisLabel: {
                        formatter: '{value} 元'
                    }
                }
            ],
            series: [
                {
                    name:'线上成交',
                    type:'bar',
                    data:[<foreach  name="_list" item="vo">
                               '{$vo.xscj}',
                           </foreach>]
                },
                {
                    name:'线下成交',
                    type:'bar',
                    data:[<foreach  name="_list" item="vo">
                               '{$vo.xxcj}',
                           </foreach>]
                },
                {
                    name:'套系均价',
                    type:'line',
                    yAxisIndex: 1,
                    data:[<foreach  name="_list" item="vo">
							<?php  $junjia = $vo['setmoney']/$vo['zcj']; $junjia =  sprintf("%.0f", $junjia); ?>
                            '{$junjia}',
                          </foreach>] 
                }
            ]
        };


        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
	<!-- 数据列表 -->
	<div class="data-table">
        <div class="data-table table-striped">
<table class="">
    <thead>
        <tr>
		<th class="">日期</th>
        <th class="">建单</th>
		<th class="">微信</th>
        <th class="">手机</th>
		<th class="">邀约</th>
		<th class="">实际进店</th>
        <th class="">线上成交</th>
		<th style="background:#28b779;">进店率</th>
        <th style="background:#da542e;">改期率</th>
		<th class="">线下流失</th>
		<th class="">流失</th>
        <th style="background:#f74d4d;">流失率</th>
        <th class="">线下成交</th>
        <th style="background:#27a9e3;">线下成交率</th>
        <th class="">均价</th>
		</tr>
    </thead>
    <tbody>
	
	<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
			<td>{$vo.time}</td>
			<td>{$vo.jd}</td>
            <td>{$vo.qq}</td>
            <td>{$vo.phone}</td>
            <td>{$vo.yytime}</td>
			<td>{$vo.jindtime}</td>
			<td>{$vo.xscj}</td>
            <td><?php echo number_format(($vo['jindtime']+$vo['xscj'])/$vo['jd'],2)*100; ?>%</td>
			<td><?php echo number_format($vo['wddtime']/$vo['yytime'],2)*100; ?>%</td>
			<td>{$vo.xxlstime}</td>
			<td>{$vo.lstime}</td>
			<td><?php echo number_format($vo['lstime']/$vo['jd'],2)*100; ?>%</td>
			<td>{$vo.xxcj}</td>
			<td><?php echo number_format($vo['xxcj']/$vo['jindtime'],2)*100; ?>%</td>
            <td><?php echo number_format($vo['setmoney']/$vo['zcj'],0); ?></td>
			
		</tr>
		
		</volist>
		<else/>
		<td colspan="12" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
        <tr>
            <td style="background-color:#51D0CA;">总计</td>
            <td style="background-color:#51D0CA;">{$zj.jd}</td>
            <td style="background-color:#51D0CA;">{$zj.qq}</td>
            <td style="background-color:#51D0CA;">{$zj.phone}</td>
            <td style="background-color:#51D0CA;">{$zj.yytime}</td>
			<td style="background-color:#51D0CA;">{$zj.jindtime}</td>
			<td style="background-color:#51D0CA;">{$zj.xscj}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format(($zj['jindtime']+$zj['xscj'])/$zj['jd'],2)*100; ?>%</td>
			<td style="background-color:#51D0CA;"><?php echo number_format($zj['wddtime']/$zj['yytime'],2)*100; ?>%</td>
			<td style="background-color:#51D0CA;">{$zj.xxlstime}</td>
			<td style="background-color:#51D0CA;">{$zj.lstime}</td>
			<td style="background-color:#51D0CA;"><?php echo number_format($zj['lstime']/$zj['jd'],2)*100; ?>%</td>
			<td style="background-color:#51D0CA;">{$zj.xxcj}</td>
			<td style="background-color:#51D0CA;"><?php echo number_format($zj['xxcj']/$zj['jindtime'],2)*100; ?>%</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['setmoney']/$zj['zcj'],0); ?></td>
        </tr>
	</tbody>
    </table>

        </div>
    </div>
    <div class="page">

    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
</block>
